package com.xinqi.modules.databank.v1.manager.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xinqi.common.mybatis.data.service.impl.BaseServiceImpl;
import com.xinqi.modules.databank.v1.domain.CourseQuestionLibraryEntity;
import com.xinqi.modules.databank.v1.manager.CourseQuestionLibraryManager;
import com.xinqi.modules.databank.v1.mapper.CourseQuestionLibraryMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class CourseQuestionLibraryManagerImpl extends BaseServiceImpl<CourseQuestionLibraryMapper, CourseQuestionLibraryEntity> implements CourseQuestionLibraryManager {

    /**
     * 根据互动环节ID获取试题
     */
    @Override
    public List<CourseQuestionLibraryEntity> findByPartId(Long partId) {
        LambdaQueryWrapper<CourseQuestionLibraryEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CourseQuestionLibraryEntity::getResourcePartId, partId);
        wrapper.orderByAsc(CourseQuestionLibraryEntity::getSort);
        return this.list(wrapper);
    }

}
